#ifndef DEVICEFACTORY_H
#define DEVICEFACTORY_H

#include <QObject>

#include "devicewidget_p.h"

class DeviceFactory : public QObject, public IMMNotificationClient
	{
		Q_OBJECT

		public:
			explicit DeviceFactory(QObject *parent = 0);
			~DeviceFactory();

			virtual ULONG STDMETHODCALLTYPE AddRef();
			virtual ULONG STDMETHODCALLTYPE Release();

			IMMDevice * getDeviceById(LPCWSTR);
			QString getDeviceName(IMMDevice *);
			LPGUID getDeviceId(IMMDevice *);

			virtual HRESULT STDMETHODCALLTYPE OnDefaultDeviceChanged(EDataFlow, ERole, LPCWSTR);
			virtual HRESULT STDMETHODCALLTYPE OnDeviceAdded(LPCWSTR);
			virtual HRESULT STDMETHODCALLTYPE OnDeviceRemoved(LPCWSTR);
			virtual HRESULT STDMETHODCALLTYPE OnDeviceStateChanged(LPCWSTR, DWORD);
			virtual HRESULT STDMETHODCALLTYPE OnPropertyValueChanged(LPCWSTR, const PROPERTYKEY);
			virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID, void **);

			void setEnumerator(IMMDeviceEnumerator * dev_enum);

		private:
			LONG c_ref;
			IMMDeviceEnumerator * device_enum;

		signals:
			void defaultDeviceChanged(const QString &, const QString &);
			void deviceAdded(LPCWSTR);
			void deviceRemoved(LPCWSTR);

		public slots:

	};

#endif // DEVICEFACTORY_H
